package com.sgb.kjwl.view.ui.activity.self.carMaster;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityOrderDetailsBinding;
import com.sgb.kjwl.model.entity.self.AddField;
import com.sgb.kjwl.model.entity.self.MyOfferDetailsEntity;
import com.sgb.kjwl.model.entity.transport.OfferGoodsSourcePlaceEntity;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.utils.DialogFunction;
import com.sgb.kjwl.utils.DialogHelper;
import com.sgb.kjwl.utils.NumberUtil;
import com.swgk.core.util.UserOperating;
import com.sgb.kjwl.view.constant.RouterKey;
import com.sgb.kjwl.view.ui.activity.transport.BiddingOrderDetailsActivity;
import com.sgb.kjwl.view.ui.activity.transport.CargoQuotationActivity;
import com.sgb.kjwl.view.ui.activity.transport.DepartureCertificateActivity;
import com.sgb.kjwl.view.ui.activity.transport.driver.goods.FreightPrjDetailActivity;
import com.sgb.link.view.widget.ExpandedTextView;
import com.sgb.kjwl.viewmodel.self.carMakers.MyOfferDetailsModel;
import com.swgk.core.dialog.RoundDialog;
import com.swgk.core.util.ClickUtils;
import com.swgk.core.util.DateUtils;
import com.im.immodel.IMUtils;
import com.swgk.core.util.MToast;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Describe:
 * Author:  黄淋
 * Date:    2021/8/27
 * 竞价接单详情
 */
public class MyOrderDetailsActivity extends AppActivity {

    MyOfferDetailsModel viewModel;
    private ActivityOrderDetailsBinding binding;
    private String sourceNo;
    //报价no
    private String offerNo;

    private MyOfferDetailsEntity offerEntity;

    RequestOptions options = new RequestOptions().placeholder(R.mipmap.icon_company_default)//图片加载出来前，显示的图片
            .fallback(R.mipmap.icon_company_default) //url为空的时候,显示的图片
            .error(R.mipmap.icon_company_default);//图片加载失败后，显示的图片

    RequestOptions personOptions = new RequestOptions().placeholder(R.mipmap.morentu_person)//图片加载出来前，显示的图片
            .fallback(R.mipmap.morentu_person) //url为空的时候,显示的图片
            .error(R.mipmap.morentu_person);//图片加载失败后，显示的图片

    RequestOptions teamOptions = new RequestOptions().placeholder(R.drawable.icon_team_default)//图片加载出来前，显示的图片
            .fallback(R.drawable.icon_team_default) //url为空的时候,显示的图片
            .error(R.drawable.icon_team_default);//图片加载失败后，显示的图片

    public static void start(Context context, String offerNo) {
        Intent intent = new Intent(context, MyOrderDetailsActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.putExtra(RouterKey.NO, offerNo);
        context.startActivity(intent);
    }

    @Override
    protected void initView() {
        offerNo = getIntent().getStringExtra(RouterKey.NO);
        viewModel = new ViewModelProvider(this).get(MyOfferDetailsModel.class);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_order_details);
        binding.topBar.titleView.setText("接单详情");
        binding.topBar.titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17);
        binding.topBar.ivBack.setOnClickListener(v -> finish());
        binding.goodsInfoBar.setOnClickListener(this);
        binding.exchangeTab.setOnClickListener(this);
        binding.callPhoneTab.setOnClickListener(this);
        if (TextUtils.isEmpty(offerNo)) {
            finish();
        }
        viewModel.detailsLiveData.observe(this, myOfferDetailsEntity -> showData(myOfferDetailsEntity));
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!TextUtils.isEmpty(offerNo))
            viewModel.getOfferDetails(this, offerNo);
    }

    /**
     * 数据展示
     */
    public void showData(MyOfferDetailsEntity offerEntity) {
        if (offerEntity == null)
            return;
        this.offerEntity = offerEntity;
        if (!TextUtils.isEmpty(offerEntity.getSourceNo()))
            sourceNo = offerEntity.getSourceNo();
        if (!TextUtils.isEmpty(offerEntity.getNo()))
            offerNo = offerEntity.getNo();

        if (offerEntity.getOfferType() == 3) {//个人
            binding.companyNameHint.setVisibility(View.GONE);
            binding.companyNameValue.setVisibility(View.GONE);
            binding.companyCodeHint.setVisibility(View.GONE);
            binding.companyCodeValue.setVisibility(View.GONE);
            binding.companyTypeHint.setVisibility(View.GONE);
            binding.companyTypeValue.setVisibility(View.GONE);
            binding.companyCapitalHint.setVisibility(View.GONE);
            binding.companyCapitalValue.setVisibility(View.GONE);
            binding.companyFoundTimeHint.setVisibility(View.GONE);
            binding.companyFoundTimeValue.setVisibility(View.GONE);
            binding.companyAddressHint.setVisibility(View.GONE);
            binding.companyAddressHint.setVisibility(View.GONE);

            binding.ivOfferItemLogo.setVisibility(View.GONE);
            binding.rivOfferLogo.setVisibility(View.VISIBLE);
            Glide.with(this).load(offerEntity.getHeadImage()).apply(personOptions).into(binding.rivOfferLogo);
            binding.companyName.setText(TextUtils.isEmpty(offerEntity.getName()) ? "/" : offerEntity.getName());
            binding.businessAddress.setText(TextUtils.isEmpty(offerEntity.getName()) ? "/" : offerEntity.getName());
            binding.businessAddressText.setText(TextUtils.isEmpty(offerEntity.getTelphone()) ? "" : offerEntity.getTelphone());
        } else if (offerEntity.getOfferType() == 1) {//企业
            binding.companyNameHint.setVisibility(View.VISIBLE);
            binding.companyNameValue.setVisibility(View.VISIBLE);
            binding.companyCodeHint.setVisibility(View.VISIBLE);
            binding.companyCodeValue.setVisibility(View.VISIBLE);
            binding.companyTypeHint.setVisibility(View.VISIBLE);
            binding.companyTypeValue.setVisibility(View.VISIBLE);
            binding.companyCapitalHint.setVisibility(View.VISIBLE);
            binding.companyCapitalValue.setVisibility(View.VISIBLE);
            binding.companyFoundTimeHint.setVisibility(View.VISIBLE);
            binding.companyFoundTimeValue.setVisibility(View.VISIBLE);
            binding.companyAddressHint.setVisibility(View.VISIBLE);
            binding.companyAddressValue.setVisibility(View.VISIBLE);

            binding.carInfoHint.setVisibility(View.GONE);
            binding.carInfo.setVisibility(View.GONE);
            binding.carLocationHint.setVisibility(View.GONE);
            binding.carLocation.setVisibility(View.GONE);

            binding.ivOfferItemLogo.setVisibility(View.VISIBLE);
            binding.rivOfferLogo.setVisibility(View.GONE);
            Glide.with(this).load(offerEntity.getHeadImage()).apply(options).into(binding.ivOfferItemLogo);

            binding.companyNameValue.setText(TextUtils.isEmpty(offerEntity.getCompanyName()) ? "/" : offerEntity.getCompanyName());
            binding.companyCodeValue.setText(TextUtils.isEmpty(offerEntity.getCreditCode()) ? "/" : offerEntity.getCreditCode());
            binding.companyTypeValue.setText(TextUtils.isEmpty(offerEntity.getCompanyType()) ? "/" : offerEntity.getCompanyType());
            binding.companyCapitalValue.setText(TextUtils.isEmpty(offerEntity.getRegisteredCapital()) ? "/" : offerEntity.getRegisteredCapital() + "元");
            try {
                binding.companyFoundTimeValue.setText(TextUtils.isEmpty(offerEntity.getEstablishmentDate()) ? "/" : DateUtils.timestampToDate(Long.parseLong(offerEntity.getEstablishmentDate())));
            } catch (NumberFormatException exception) {

            }
            binding.companyAddressValue.setText(TextUtils.isEmpty(offerEntity.getBusinessAddress()) ? "/" : offerEntity.getBusinessAddress());

            binding.companyName.setText(TextUtils.isEmpty(offerEntity.getCompanyName()) ? "/" : offerEntity.getCompanyName());
            binding.businessAddress.setText(TextUtils.isEmpty(offerEntity.getName()) ? "/" : offerEntity.getName());
            binding.businessAddressText.setText(TextUtils.isEmpty(offerEntity.getTelphone()) ? "" : offerEntity.getTelphone());
        } else if (offerEntity.getOfferType() == 2) {//团队
            binding.companyNameHint.setVisibility(View.VISIBLE);
            binding.companyNameValue.setVisibility(View.VISIBLE);
            binding.companyCodeHint.setVisibility(View.VISIBLE);
            binding.companyCodeValue.setVisibility(View.VISIBLE);
            binding.companyTypeHint.setVisibility(View.VISIBLE);
            binding.companyTypeValue.setVisibility(View.VISIBLE);
            binding.companyCapitalHint.setVisibility(View.VISIBLE);
            binding.companyCapitalValue.setVisibility(View.VISIBLE);
            binding.companyCapitalValue.setTextColor(getResources().getColor(R.color.color_tab_one));

            binding.companyNameHint.setText("团队名称");
            binding.companyCodeHint.setText("经营业务");
            binding.companyTypeHint.setText("团队人数");
            binding.companyCapitalHint.setText("经营地址");

            binding.companyFoundTimeHint.setVisibility(View.GONE);
            binding.companyFoundTimeValue.setVisibility(View.GONE);
            binding.companyAddressHint.setVisibility(View.GONE);
            binding.companyAddressValue.setVisibility(View.GONE);
            binding.carInfoHint.setVisibility(View.GONE);
            binding.carInfo.setVisibility(View.GONE);
            binding.carLocationHint.setVisibility(View.GONE);
            binding.carLocation.setVisibility(View.GONE);
            binding.ivOfferItemLogo.setVisibility(View.GONE);
            binding.rivOfferLogo.setVisibility(View.VISIBLE);
            Glide.with(this).load(offerEntity.getHeadImage()).apply(teamOptions).into(binding.rivOfferLogo);

            binding.companyNameValue.setText(TextUtils.isEmpty(offerEntity.getTeamName()) ? "/" : offerEntity.getTeamName());
            binding.companyCodeValue.setText(TextUtils.isEmpty(offerEntity.getBusinessType()) ? "/" : offerEntity.getBusinessType());
            binding.companyTypeValue.setText(TextUtils.isEmpty(offerEntity.getScale()) ? "/" : offerEntity.getScale() + "人");
            binding.companyCapitalValue.setText(TextUtils.isEmpty(offerEntity.getBusinessAddress()) ? "/" : offerEntity.getBusinessAddress());

            binding.companyName.setText(TextUtils.isEmpty(offerEntity.getTeamName()) ? "/" : offerEntity.getTeamName());
            binding.businessAddress.setText(TextUtils.isEmpty(offerEntity.getName()) ? "/" : offerEntity.getName());
            binding.businessAddressText.setText(TextUtils.isEmpty(offerEntity.getTelphone()) ? "" : offerEntity.getTelphone());
        }
        if (!TextUtils.isEmpty(offerEntity.getTelphone())) {
            binding.businessAddressText.setOnClickListener(view ->
                    DialogHelper.showDialog(this, "确认呼叫", offerEntity.getTelphone(), "确定", new DialogFunction() {
                        @Override
                        public void normalRoundDialog() {
                            ActivityJump.jumpToPhone(MyOrderDetailsActivity.this, offerEntity.getTelphone());
                        }
                    })
            );
        }

        //货源方
        if (offerEntity.getPlace() != null) {
            OfferGoodsSourcePlaceEntity placeEntity = offerEntity.getPlace();
            String offerPlace = "";
            String add_s = "";
            if (!TextUtils.isEmpty(placeEntity.getCityName())) {
                add_s += placeEntity.getCityName() + " ";
            }
            if (!TextUtils.isEmpty(placeEntity.getDistrictName())) {
                add_s += placeEntity.getDistrictName();
            }
            if (!TextUtils.isEmpty(add_s)) {
                offerPlace += add_s;
            }


            String add_e = "";
            if (!TextUtils.isEmpty(placeEntity.getDestCityName())) {
                add_e += placeEntity.getDestCityName() + " ";
            }
            if (!TextUtils.isEmpty(placeEntity.getDestDistrictName())) {
                add_e += placeEntity.getDestDistrictName();
            }
            if (!TextUtils.isEmpty(add_e)) {
                offerPlace += " → ";
                offerPlace += add_e;
            }
            binding.offerPlaceS.setText(offerPlace);

//            if (!TextUtils.isEmpty(placeEntity.getTotalDistance())) {
//                StringBuilder builder = new StringBuilder();
//                builder.append("运程：约").append(placeEntity.getTotalDistance()).append("km");
//                binding.tvTotalDiatance.setText(builder);
//            }
        }

        String goodsInfo = "";
        if (!TextUtils.isEmpty(offerEntity.getGoodsTypeName())) {
            goodsInfo += offerEntity.getGoodsTypeName();
        }
        if (!TextUtils.isEmpty(offerEntity.getSecondGoodsTypeName())){
            goodsInfo+="/"+offerEntity.getSecondGoodsTypeName();
        }
        if (!TextUtils.isEmpty(offerEntity.getWeight())) {
            goodsInfo += " " + NumberUtil.trim0(offerEntity.getWeight()) + "吨";
        }
        if (!TextUtils.isEmpty(offerEntity.getVolume())) {
            goodsInfo += " " + NumberUtil.trim0(offerEntity.getVolume()) + "方";
        }
        binding.goodsTv.setText(TextUtils.isEmpty(goodsInfo) ? "/" : goodsInfo);


        if (!TextUtils.isEmpty(offerEntity.getShipmentTime()) && !TextUtils.isEmpty(offerEntity.getShipmentEndTime())) {
            binding.shipmentTime.setText(DateUtils.formatDate(offerEntity.getShipmentTime(), "yyyy/MM/dd")
                    + "-" + DateUtils.formatDate(offerEntity.getShipmentEndTime(), "yyyy/MM/dd"));
        } else {
            binding.shipmentTime.setText("/");
        }

        if (!TextUtils.isEmpty(offerEntity.getSourceMessagePrice())) {
            binding.infoAmount.setText(NumberUtil.trim0(offerEntity.getSourceMessagePrice()) + "元");
        } else {
            binding.infoAmount.setText("/");
        }
        if (!TextUtils.isEmpty(offerEntity.getMessagePrice())) {
//            binding.messagePrice.setText(NumberUtil.trim0(offerEntity.getMessagePrice()) + "元");
        } else {
//            binding.messagePrice.setText("/");
        }

        //运费单价
        String unitStr = "";
        if (!TextUtils.isEmpty(offerEntity.getSourceFreight())) {
            unitStr += NumberUtil.trim0(offerEntity.getSourceFreight());
            if (!TextUtils.isEmpty(offerEntity.getFreightUnit()))
                unitStr += offerEntity.getFreightUnit();
        }
        binding.freightUnit.setText(TextUtils.isEmpty(unitStr) ? "/" : unitStr);

        //总价
        if (!TextUtils.isEmpty(offerEntity.getSourceAllFreight())) {
            binding.freight.setText(NumberUtil.trim0(offerEntity.getSourceAllFreight()) + "元");
        } else {
            binding.freight.setText("/");
        }
        if (!TextUtils.isEmpty(offerEntity.getFreight())) {
            binding.myOffer.setText(NumberUtil.trim0(offerEntity.getFreight()) + "元/吨");
        } else {
            binding.myOffer.setText("/");
        }

        //报价状态：1已报价  2已同意  3报价未同意 4超时未支付
        switch (offerEntity.getOfferStatus()) {
            case "1"://已报价
                binding.offerStatus.setText("已接单");
                binding.offerStatus.setTextColor(getResources().getColor(R.color.color_5792FD));
                binding.llRightBtn.setVisibility(View.GONE);

                break;

            case "2"://已同意
                binding.offerStatus.setText("货主已同意");
                binding.offerStatus.setTextColor(getResources().getColor(R.color.color_06C764));
                binding.llRightBtn.setVisibility(View.VISIBLE);
                binding.llRightBtn.setOnClickListener(v -> {
                    toOrderDetail(offerEntity.getOrderNo());
                });
                break;

            case "3"://未同意
            default:
                binding.offerStatus.setText("货主未同意");
                binding.offerStatus.setTextColor(getResources().getColor(R.color.FF2928));
                binding.llRightBtn.setVisibility(View.GONE);
                break;
        }

        //报价方
        if (!TextUtils.isEmpty(offerEntity.getCreateTime())) {
            binding.offerTime.setText(DateUtils.formatDate(offerEntity.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
        } else {
            binding.offerTime.setText("/");
        }

        //车辆位置
        String address = "";
        if (!TextUtils.isEmpty(offerEntity.getDetailAddress()))
            address += offerEntity.getDetailAddress();
        binding.carLocation.setText(TextUtils.isEmpty(address) ? "/" : address);


        //联系信息
        String contactStr = "";
        if (!TextUtils.isEmpty(offerEntity.getContrcts()))
            contactStr += offerEntity.getContrcts();
        binding.contactInfo.setText(TextUtils.isEmpty(contactStr) ? "/" : contactStr);
        binding.contactInfoPhone.setText(TextUtils.isEmpty(offerEntity.getContrctsNumber()) ? "" : offerEntity.getContrctsNumber());

        //车辆信息
        String carInfo = "";
        if (!TextUtils.isEmpty(offerEntity.getCarNumber()))
            carInfo += offerEntity.getCarNumber() + " ";
        if (!TextUtils.isEmpty(offerEntity.getCarTypeName()))
            carInfo += offerEntity.getCarTypeName() + " ";
        if (!TextUtils.isEmpty(offerEntity.getCarLenName()))
            carInfo += offerEntity.getCarLenName() + " ";
        //栏高
        if (!TextUtils.isEmpty(offerEntity.getHeightHurdle()))
            carInfo += "栏高" + NumberUtil.trim0(offerEntity.getHeightHurdle()) + "米 ";
        //是否自卸
        if (!TextUtils.isEmpty(offerEntity.getIsDump())) {
            if (offerEntity.getIsDump().equals("1")) {
                carInfo += "自卸";
            } else {
                carInfo += "非自卸";
            }
        }
        binding.carInfo.setText(TextUtils.isEmpty(carInfo) ? "/" : carInfo);

        //备注
        if (!TextUtils.isEmpty(offerEntity.getNote())) {
            binding.remarkLayout.setVisibility(View.VISIBLE);
            binding.contentView.setText(offerEntity.getNote());
            new ExpandedTextView().showTextPick(binding.contentView, binding.expandView);
        } else {
            binding.remarkLayout.setVisibility(View.GONE);
        }

        //自定义字段
        if (offerEntity.getDiyField() != null && offerEntity.getDiyField().size() > 0) {
            binding.customContent.setVisibility(View.VISIBLE);
            binding.customContent.removeAllViews();
            for (int i = 0; i < offerEntity.getDiyField().size(); i++) {
                AddField itemEntity = offerEntity.getDiyField().get(i);
                if (!TextUtils.isEmpty(itemEntity.getValue()))
                    addCustomLayout(binding.customContent, itemEntity);
            }
        } else {
            binding.customContent.setVisibility(View.GONE);
        }

        //附件展示
        if (TextUtils.isEmpty(offerEntity.getAccessory())) {
            binding.annexHint.setVisibility(View.GONE);
            binding.annexInfo.setVisibility(View.GONE);
        } else {
            binding.annexInfo.setOnClickListener(this);
        }

        String inTime = DateUtils.stampToDay5(offerEntity.getInTime());
        binding.arriveTime.setText(TextUtils.isEmpty(inTime) ? "/" : inTime);

        binding.scrollView.setVisibility(View.VISIBLE);
        binding.bottomBar.setVisibility(View.VISIBLE);
    }

    @Override
    public void onMultiClick(View v) {
        switch (v.getId()) {
            case R.id.goods_info_bar:
                //跳转货源详情
                if (!TextUtils.isEmpty(sourceNo)) {
                    FreightPrjDetailActivity.start(getActivity(), sourceNo, false, false);
//                      GeneralPrjDetailActivity.start(getActivity(), sourceNo, 1, false);
                }
                break;
            case R.id.annex_info://查看附件
                if (!ClickUtils.isDoubleClick2()) {
                    try {
                        List<String> images = new ArrayList<>();
                        String[] strings = offerEntity.getAccessory().split(",");
                        Collections.addAll(images, strings);
                        DepartureCertificateActivity.start(getActivity(), images, true);
                    } catch (Exception e) {

                    }
                }
                break;
            //IM
            case R.id.exchange_tab:
                if (UserOperating.getInstance().isNotLogged(MyOrderDetailsActivity.this)) {
                    return;
                }
                if (offerEntity != null && !TextUtils.isEmpty(offerEntity.getGoodsOwnerIM())) {
//                    MToast.showToast(getActivity(), "功能未开方");
//                    NimUIKit.startP2PSession(this, offerEntity.getGoodsOwnerIM());
                    IMUtils.getInstance().buildSingleTalking(offerEntity.getGoodsOwnerIM());
                }
                break;

            //打电话
            case R.id.call_phone_tab:
                if (UserOperating.getInstance().isNotLogged(MyOrderDetailsActivity.this)) {
                    return;
                }
                if (offerEntity != null && !TextUtils.isEmpty(offerEntity.getGoodsOwnerPhone())) {
                    showCallDialog(offerEntity.getGoodsOwnerPhone());
                } else {
                    MToast.showToast(getActivity(), "无联系方式");
                }
                break;

        }
    }

    /**
     * 打电话弹窗
     *
     * @param phone
     */
    public void showCallDialog(String phone) {
        new RoundDialog.Builder(this)
                .title("确认呼叫")
                .content(phone)
                .cancel("取消")
                .confirm("确定")
                .contentGravity(Gravity.CENTER)
                .cancelable(false)
                .confirmCallback(v -> callPhone(phone))
                .show();
    }


    /**
     * 更新报价
     */
    private void updateOffer() {
        if (!TextUtils.isEmpty(sourceNo))
            CargoQuotationActivity.startForResult(MyOrderDetailsActivity.this, sourceNo, true, UserOperating.getInstance().isPersonal() ? true : false, offerEntity.getFreight());
    }


    /**
     * 查看竞价订单详情
     */
    private void toOrderDetail(String orderNo) {
//        Intent intent = new Intent(getActivity(), TransportOrderDetailOwnerActivity.class);
//        intent.putExtra("isGoodsOwner", 0);//这里是车主，传值：0
//        intent.putExtra("no", orderNo);//订单编号
//        startActivity(intent);
        BiddingOrderDetailsActivity.start(this, orderNo, 1);
    }

    /**
     * 为自定义字段添加布局
     *
     * @param content
     * @param entity
     */
    private void addCustomLayout(LinearLayout content, AddField entity) {
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.custom_field_layout_new, null);
        TextView remark_hint = view.findViewById(R.id.remark_hint);
        TextView content_tv = view.findViewById(R.id.content_tv);
        TextView expand_tv = view.findViewById(R.id.expand_tv);
        if (!TextUtils.isEmpty(entity.getKey())) {
            remark_hint.setText(entity.getKey());
        } else
            remark_hint.setText("自定义");

        content_tv.setText(entity.getValue());
        new ExpandedTextView().showTextPick(content_tv, expand_tv);
        content.addView(view);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == CargoQuotationActivity.REQUEST_CODE && resultCode == CargoQuotationActivity.RESULT_CODE) {
            if (data != null && !TextUtils.isEmpty(data.getStringExtra("no"))) {
                offerNo = data.getStringExtra("no");
            }
        }
    }
}
